home *** CD-ROM | disk | FTP | other *** search
- Path: linux.nildram.co.uk!usenet
- From: colin@greench.co.uk (Colin Wray)
- Newsgroups: comp.lang.c
- Subject: Re: Newbie needs help w/ARGV ARGC
- Date: Fri, 29 Mar 1996 21:57:30 GMT
- Organization: Greenchurch Software Ltd
- Message-ID: <4jhmmn$smd@linux.nildram.co.uk>
- References: <4j4ja1$dc3@mtinsc01-mgt.ops.worldnet.att.net>
- NNTP-Posting-Host: pppn.nildram.co.uk
- X-Newsreader: Forte Free Agent 1.0.82
-
- dslayer@worldnet.att.net (Raymond Joh) wrote:
-
- >I have spent three days attempting to determine why my command line
- >arguments are failing...
-
- >I am using MS Quick C 2.5
-
- >I just want to be able to enter two file paths at the command line.
- >Here is my code:
-
- >#include <stdio.h>
- >#include <stdlib.h>
-
-
-
- >main(int argc, char *argv[],char *envp[])
- >{
- >FILE *ofp,*nfp;
- >char ch;
-
- >gets(*argv);
- This reads chars from stdin into argv[0] which is :
- 1. the program name string
- 2. not long enough.
- Just omit the 'gets'; argv[1] and argv[2] already hold your two
- command line args.
- >if (argc!=3)
- > {
- > printf("Enter: <source> <destination>\n");
- > exit(1);
- > }
-
- >Code countinues but when I enter my command line input such as:
-
- >A:\readme.txt A:\newfile.txt
-
- >I get my arvc error message above
- >I'm sure I've missed something simple but it has me stumped.
- >(win95 if OS matters.)
- >Thanks in Advance!!
- >Raymond Joh
- >##############################################################
- >Raymond Joh If you can't tie a good knot...
- >Dslayer@gnn.com ...Tie a BUNCH of them!!!
- >Dslayer@worldnet.att.net
- >Home Page ==>>http://members.aol.com/ggjoh/index.htm
- >##############################################################
-
-
-
- ----------------------------------------------------------------------------
- Colin Wray, Greenchurch Software Ltd, UK
- Email: colin@greench.co.uk
- ----------------------------------------------------------------------------
-
-